const App = {
    // mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            getYMDHMSDate,
            accAdd,
            relativePath: '',
            account: {},
            page: {
                activeName: 'first',
                SQLSerialNumber: 't_personal_points_change_log',
                PaginationNumber: 1, //页码
                RowAmount: 10,
                Condition: window.btoa(unescape(encodeURIComponent("%%,%%")))
            },
            tableData: [],
            Total: 0,
        }
    },
    mounted() {
        let ls_URL = window.location.href;
        this.relativePath = ls_URL.substring(
            ls_URL.lastIndexOf("view"),
            ls_URL.length
        );
        this.nodeKey = getQueryObject(ls_URL, "nodeKey");// 获取 nodeKey 参数
        this.page.Condition = window.btoa(unescape(encodeURIComponent("%%,%" + this.nodeKey + "%")))
        this.handleShow(this.nodeKey);
        this.getList(this.page);
    },
    methods: {
        handleClick() {
            if (this.page.activeName == 'first') {
                this.page.ExtensionCondition = window.btoa(unescape(encodeURIComponent("")));
            } else if (this.page.activeName == 'second') {
                this.page.ExtensionCondition = window.btoa(unescape(encodeURIComponent("AND personal_points_change_log.Points_Type = '1'")));
            } else if (this.page.activeName == 'three') {
                this.page.ExtensionCondition = window.btoa(unescape(encodeURIComponent("AND personal_points_change_log.Points_Type = '0'")));
            }
            this.getList(this.page);
        },
        handleSizeChange(newSize) {
            this.page.PaginationNumber = 1;
            this.page.RowAmount = newSize;
            this.getList(this.page);
        },
        handleCurrentChange(newPage) {
            this.page.PaginationNumber = newPage;
            this.getList(this.page);
        },
        handleShow(val) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    SQLSerialNumber: 'f_personal_points_account',
                    Condition: window.btoa(unescape(encodeURIComponent(val))),
                    ExtensionCondition: ''
                },
                success: (res) => {
                    this.account = res[0];
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                }
            })
        },
        getList(data) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                method: "post",
                data,
                success: (res) => {
                    this.Total = res.TotalRows;//总数量
                    this.tableData = res.Rows;
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                }
            })
        },
        goBack() {
            window.history.back();
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
